package com.szholly.plug.form.core.interceptor;

import com.szholly.utils.util.StringUtils;
import com.szholly.data.general.ITable;
import com.szholly.data.general.interceptor.DbEditType;

public abstract class FormEditInterceptorClass extends FormInterceptorClass
		implements IFormEditInterceptor {
	/**
	 * 编辑操作前
	 * 
	 * @param table
	 * @param editEntitys
	 * @param editType
	 */
	public abstract String BeforeDbEditOption(ITable table, Object editEntitys,
			DbEditType editType);

	/**
	 * 编辑操作前
	 */
	public static String BeforeDbEditOptionEx(ITable table, Object editEntitys,
			DbEditType editType) {
		for (IFormEditInterceptor editItem : FormInterceptorRegister.dbEditInterceptor) {
			if (editItem != null && editItem.contains(table.getTableName())) {
				String returnString = editItem.BeforeDbEditOption(table, editEntitys, editType);
				if(!StringUtils.IsNullOrSpace(returnString)){
					return returnString;
				}
			}
		}
		return null;
	}
}